const mysql = require('mysql');
const connection = mysql.createConnection({
    host     : 'localhost',
    user     : 'root',
    password : 'admin@123',
    database : 'test',
    port: 3306
});

connection.connect();
connection.query(`INSERT INTO test(userName, password) VALUES ('erfeng', null)`,function(err, result){
    console.log(err, result);
    connection.query(`select * from test`, (error, result) => {
        console.log(error, result);
    });
})